home *** CD-ROM | disk | FTP | other *** search
- class com.ndimedia.ui.RadioButtonGroup
- {
- var m_abuttons;
- var dispatchEvent;
- var addEventListener;
- function RadioButtonGroup()
- {
- mx.events.EventDispatcher.initialize(this);
- this.m_abuttons = new Array();
- }
- function addButton(rb)
- {
- this.m_abuttons.push(rb);
- rb.setGroup(this);
- if(this.m_abuttons.length == 1)
- {
- this.select(rb);
- this.valueChanged();
- }
- }
- function valueChanged()
- {
- var _loc2_ = new com.ndimedia.events.Event("CHANGED",this);
- this.dispatchEvent(_loc2_);
- }
- function addOnChangeCommand(command)
- {
- var eb = com.ndimedia.events.EventBroadcaster.getInstance();
- this.addEventListener("CHANGED",function()
- {
- eb.broadcastEvent(new com.ndimedia.events.Event(command,this));
- }
- );
- }
- function getValue()
- {
- var _loc4_ = null;
- var _loc2_ = 0;
- while(_loc2_ < this.m_abuttons.length)
- {
- var _loc3_ = this.m_abuttons[_loc2_];
- if(_loc3_.isSelected())
- {
- _loc4_ = _loc3_.getValue();
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc4_;
- }
- function select(rb)
- {
- var _loc2_ = 0;
- while(_loc2_ < this.m_abuttons.length)
- {
- var _loc3_ = this.m_abuttons[_loc2_];
- if(_loc3_ != rb)
- {
- _loc3_.unselect();
- }
- _loc2_ = _loc2_ + 1;
- }
- rb.select();
- this.valueChanged();
- }
- }
-